// pages/usercenter/news/index.js
let app = getApp()

Page({

  /**
   * 页面的初始数据
   */
  data: {
    tableData: []
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      spinShow: true,
      queryParam: {
      },
    });
    this.queryData()
  },

  queryData: function () {
    let _this = this

    app.formGet('/app/news/list', this.data.queryParam).then(res => {
      _this.setData({
        spinShow: false
      });
      wx.stopPullDownRefresh()
      if (res.code === 0) {
        _this.setData({
          tableData: res.data.list
        });
      } else if (res.code == 999) {
        app.message(res.message, 'error')
      } else if (res.code == -1){
        app.message(res.message, 'error')
      } else {
        app.message(res.message, 'error')
      }
    }).catch(e => {
      _this.setData({
        spinShow: false
      });
      app.message(e, 'error')
    })
  },


})